$(function () {
    var schoolId = xhTool.getQuery('schoolId');
    var packageName = xhTool.getQuery('packageName');
    var form = new xhForm($('#xh_form'));

    if(packageName != null){
        form.parse();
        //提交按钮处理事件
        $('[name=packageName]').parent().parent().remove();
        $('#bt_modal_confirm',window.top.document).click(function () {
            form.submit('appserver/modifySchoolFireWall',{schoolId:schoolId,packageName:packageName},function (res) {
                window.top.xhTop.showSuccess(res.msg);
                window.top.xhTop.getActiveFrame().obj.dataGrid.reload();
                window.top.xhTop.closeModal();
            });
        });
    }else {
        form.parse().bindRequired($('#bt_modal_confirm',window.top.document));
        //提交按钮处理事件

        $('#bt_modal_confirm',window.top.document).click(function () {
            form.submit('appserver/addSchoolFirewall',{schoolId:schoolId},function (res) {
                window.top.xhTop.showSuccess(res.msg);
                window.top.xhTop.getActiveFrame().obj.dataGrid.reload();
                window.top.xhTop.closeModal();
            });
        });
    }

});